﻿using System;
using System.Windows.Forms;
using RSPJ.Struct;

namespace RSPJ.Windows
{
    public partial class EditHeader : Form
    {
        public Head head;
        public EditHeader(Head head)
        {
            InitializeComponent();
            this.head = head;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            head.Samples = int.Parse(txtSamples.Text);
            head.Lines = int.Parse(txtLines.Text);
            head.Bands = int.Parse(txtBands.Text);
            head.Header_offset = int.Parse(txtOffset.Text);
            head.File_type = txtFileType.Text;
            head.Data_type = int.Parse(txtDataType.Text);
            head.Interleave = txtInterleave.Text;
            DialogResult = DialogResult.OK;
            Close();
        }

        private void EditHeader_Shown(object sender, EventArgs e)
        {
            txtSamples.Text = head.Samples.ToString();
            txtLines.Text = head.Lines.ToString();
            txtBands.Text = head.Bands.ToString();
            txtOffset.Text = head.Header_offset.ToString();
            txtDataType.Text = head.Data_type.ToString();
            txtFileType.Text = head.File_type;
            txtInterleave.Text = head.Interleave;
        }
    }
}
